import com.pojo.Student;
import com.pojo.TCustomer;
import com.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class StudentTest {
    @Test
    public void findStudentByNameOrMajorTest(){
        SqlSession session = MyBatisUtils.getSession();
        Student  student = new Student();
        student.setSname("Jim");
        student.setMaior("计应");
        List<Student> students =session.
                selectOne("com.mapper.StudentMapper.findStudentByNameOrMajor",student);
        for (Student s:students){
            System.out.println(s);
        }
        session.close();
    }
    @Test
    public void findByArrayTest(){
        SqlSession sqlSession = MyBatisUtils.getSession();
        Integer [] roleIds = {1,2,3,4};
        List<Student> students = sqlSession.
                selectList("com.mapper.StudentMapper.findStudentByIds", roleIds);
        for (Student student:students){
            System.out.println(student);
        }
//        sqlSession.commit();
        sqlSession.close();
    }
}
